home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 June / PCWorld_2007-06_cd.bin / zabezpeceni / spyeraser / spyeraser.exe / {app} / SpyEraser.dll / 2110 / MANAGE.JS < prev    next >
Text File  |  2007-04-23  |  3KB  |  108 lines

  1.  
  2. /////manage Page
  3. //===================
  4.     var prev_row=null;
  5.     var objName=null;
  6.     function manage_clear()
  7.     {
  8.         var theTable = document.all['manage_table'];
  9.         var lastRow = theTable.rows.length;
  10.         for(i=0; i<lastRow ; i++)
  11.         {
  12.             theTable.deleteRow(0); 
  13.         }
  14.     }
  15.     function onRowClick(){
  16.         var elem=event.srcElement;
  17.         var id;
  18.         do{
  19.             id=elem.id;
  20.             elem=elem.parentElement;
  21.         }while(! (document.all[id] && id.search('manage')>=0));
  22.         var row=document.all[id];
  23.         highlightRow(row);
  24.     }
  25.     function highlightRow(row)
  26.     {
  27.         if(prev_row != row){
  28.             if(prev_row!=null){
  29.                 prev_row.style.backgroundColor="white";
  30.             }
  31.             //row.style.backgroundColor="#DFE6F9";
  32.             row.style.backgroundColor="#BAC6E1";
  33.             
  34.             prev_row=row;
  35.         }
  36.     }
  37.     function manage_add(obj,key)
  38.     {    
  39.         if(obj=="")
  40.         {
  41.             obj="No items to manage";
  42.             var theTable = document.all['manage_table'];
  43.             var lastRow = theTable.rows.length;
  44.             var row  =theTable.insertRow();
  45.             row.setAttribute('id','manage'+lastRow);
  46.             row.onclick=onRowClick;
  47.             var cell = row.insertCell(); 
  48.             cell.setAttribute('align',"left");
  49.             cell.setAttribute('height',30);
  50.             cell.innerHTML=obj;
  51.             document.all['manage_remove'].disabled=true;
  52.         }else
  53.         {
  54.             var theTable = document.all['manage_table'];
  55.             var lastRow = theTable.rows.length;
  56.             var row  =theTable.insertRow();
  57.             row.setAttribute('id','manage'+lastRow);
  58.             row.onclick=onRowClick;
  59.             row.key=key;
  60.             var cell = row.insertCell(); 
  61.             cell.setAttribute('width',20);
  62.             cell.setAttribute('align',"left");
  63. //            alert("check"+lastRow);
  64.             cell.innerHTML="<input type='checkbox' id='check"+lastRow+"' >" ;
  65.             cell = row.insertCell(); 
  66.             cell.setAttribute('align',"left");
  67.             cell.innerHTML=obj;    
  68.             document.all['manage_remove'].disabled=false;
  69.         }
  70.         highlightRow(row);
  71.     }
  72.     function getObjectKey(index){
  73.         var str='manage'+index;
  74.         var row=document.all[str];
  75.         if(row!=null){
  76.             return row.key;
  77.         }
  78.         else
  79.         {
  80.             return "";
  81.         }
  82.     }
  83.     function setObjectName(name){
  84.         document.all['manage_display'].innerText="allowed "+name+"s";
  85.         document.all['manage_title'].innerText=name;
  86.         var str1=null;
  87.         str1="<select name=\"manage_combo\" onChange=\"onSelectChange();\"><OPTION VALUE=\"1\">Allowed "+name+"s";
  88.         str1+="<OPTION VALUE=\"2\">Blocked "+name+"s";
  89.         str1+="</select>";
  90.         document.all['manage_combo'].outerHTML=str1;
  91.         objName=name;
  92.     };
  93.     function onSelectChange()
  94.     {
  95.         document.all['manage_select_change'].click();
  96.         var nIndex=parseInt(document.all['manage_combo'].selectedIndex);
  97.         if(nIndex==0)
  98.         {
  99.             document.all['manage_display'].innerText="allowed "+objName+"s";
  100.         }else
  101.         {
  102.             document.all['manage_display'].innerText="blocked "+objName+"s";
  103.         }
  104.     }    
  105.     function doitOnload()
  106.     {
  107.         document.all['manage_page'].click();
  108.     }